package com.maiji.cloud.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.maiji.cloud.entities.community.ComMiddleLabel;
import com.maiji.cloud.mapper.ComMidLabelMapper;
import com.maiji.cloud.response.BaseResDto;
import com.maiji.cloud.response.Status;
import com.maiji.cloud.service.ComMidLabelService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class ComMidLabelServiceImpl extends ServiceImpl<ComMidLabelMapper, ComMiddleLabel> implements ComMidLabelService {

    @Override
    public BaseResDto editComMiddleLabel (ComMiddleLabel comMiddleLabel) {
        EntityWrapper<ComMiddleLabel> entityWrapper = new EntityWrapper<>();
        entityWrapper.eq("label_id", comMiddleLabel.getLabelId());
        entityWrapper.eq("msg_id", comMiddleLabel.getMsgId());
        if (update(comMiddleLabel, entityWrapper)) return new BaseResDto(Status.SUCCESS);
        return new BaseResDto(Status.ERROR);
    }



}
